<template>
    <div>
        <div style="margin-top: 10%;margin-right: 30%;margin-left: 30%;width:300px">
            <el-form ref="form" :model="form" label-width="120px">
                <el-form-item label="客户名称：">
                    <el-input v-model="form.clint_name"></el-input>
                </el-form-item>
                <el-form-item label="公司地址：">
                    <el-input v-model="form.address"></el-input>
                </el-form-item>
                 <el-form-item label="联系人姓名：">
                    <el-input v-model="form.contacts"></el-input>
                </el-form-item>
                 <el-form-item label="联系人电话：">
                    <el-input v-model="form.contacts_phone"></el-input>
                </el-form-item>
                 <el-form-item>
                    <el-button type="primary" @click="onSubmit">立即添加</el-button>
                </el-form-item>
                </el-form>
        </div>
    </div>
</template>

<script>
import {add_client} from '../../api/api.js'
export default {
    data() {
      return {
        form: {
          clint_name: '',
          address: '',
          contacts: '',  
          contacts_phone:''   
        },
      }
    },
    mounted:function(){

    },
    methods: {
      onSubmit() {
        // console.log(this.form.clint_name,this.form.address,this.form.contacts,this.form.contacts_phone);
        var params = {
              clint_name : this.form.clint_name,
              address : this.form.address,
              contacts : this.form.contacts,
              contacts_phone : this.form.contacts_phone,
            };
            add_client(params).then(res=>{
              this.$message(res.message)
          })
      }
    }
}
</script>

<style>

</style>